var __extends =
    (this && this.__extends) ||
    (function () {
      var e = function (t, r) {
        return (e =
          Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array &&
            function (e, t) {
              e.__proto__ = t;
            }) ||
          function (e, t) {
            for (var r in t)
              Object.prototype.hasOwnProperty.call(t, r) && (e[r] = t[r]);
          })(t, r);
      };
      return function (t, r) {
        function a() {
          this.constructor = t;
        }
        if ("function" != typeof r && null !== r)
          throw new TypeError(
            "Class extends value " + String(r) + " is not a constructor or null"
          );
        e(t, r),
          (t.prototype =
            null === r
              ? Object.create(r)
              : ((a.prototype = r.prototype), new a()));
      };
    })(),
  AXMarketRechargesView = (function (e) {
    function t() {
      var t = e.call(this) || this;
      return (
        (t.onLoadPawnHistoryFn = {
          caller: t,
          code: 2100,
          method: function (e) {
            var r = [];
            0 == e.code && (r = e.list), (t.marketArr = r), (t.flyArr = []);
            for (var a, n = 0; n < r.length; n++)
              (a = {
                lbl_flyIndex: { text: n + 1 },
                his_creation_date: t.dateStringFormate(r[n].creation_date),
                his_money: r[n].gold + "金",
                his_thing_name: r[n].thing_name,
                his_buy_name: t.dealbuySaleDir(n),
              }),
                t.flyArr.push(a);
            t.list_market_history.array = t.flyArr;
          },
        }),
        (t.onLoadMarketRechargeHistoryFn = {
          caller: t,
          code: 1308,
          method: function (e) {
            var r = e.list;
            (t.marketArr = r), (t.flyArr = []);
            for (var a, n = 0; n < r.length; n++)
              (a = {
                lbl_flyIndex: { text: n + 1 },
                his_creation_date: t.dateStringFormate(r[n].creation_date),
                his_money: r[n].money,
                his_thing_name: r[n].thing_name,
                his_count: r[n].count,
                his_buy_name: r[n].buy_name,
              }),
                t.flyArr.push(a);
            t.list_market_history.array = t.flyArr;
          },
        }),
        t.btn_record_close.on(Laya.Event.CLICK, t, t.onRecordCloseFn),
        WebSocketService.addListener(t.onLoadPawnHistoryFn),
        WebSocketService.addListener(t.onLoadPawnHistoryFn),
        WebSocketService.addListener(t.onLoadMarketRechargeHistoryFn),
        t
      );
    }
    return (
      __extends(t, e),
      (t.showMarketChargesView = function (e) {
        null == this.marketChargesView &&
          ((this.marketChargesView = new t()),
          (this.marketChargesView.zOrder = 1e3)),
          this.marketChargesView.popup(!0),
          (this.marketChargesView.market_type = e),
          "10" == e
            ? (WebSocketService.send({ c: 2100, d: { type: 0, pageNum: 0 } }),
              (this.marketChargesView.label_market_recharge.text = "卖方"),
              (this.marketChargesView.label_mark_title.text = "购买记录"))
            : "11" == e
            ? (WebSocketService.send({ c: 2100, d: { type: 1, pageNum: 0 } }),
              (this.marketChargesView.label_market_recharge.text = "买方"),
              (this.marketChargesView.label_mark_title.text = "出售记录"))
            : WebSocketService.send({ c: 1308, d: { stallId: Global.roleId } });
      }),
      (t.prototype.dealbuySaleDir = function (e) {
        return "10" == this.market_type
          ? this.marketArr[e].role_id
          : "11" == this.market_type
          ? this.marketArr[e].buy_roleid
          : "";
      }),
      (t.prototype.dateStringFormate = function (e) {
        return e.substring(0, 10);
      }),
      (t.prototype.dealThingType = function (e) {
        return "2" == e
          ? "装备"
          : "3" == e
          ? "副将"
          : "5" == e
          ? "宝石"
          : "6" == e
          ? "天赋石"
          : void 0;
      }),
      (t.prototype.onRecordCloseFn = function () {
        this.close();
      }),
      (t.close = function () {
        this.marketChargesView &&
          (this.marketChargesView.close(), (this.marketChargesView = null));
      }),
      t
    );
  })(ui.MarketController.AXMarketRechargesViewUI);
